from flask import Flask
from .config import Config
from .models import db
from flask_wtf.csrf import CSRFProtect

def create_app(config_class=Config):
    app = Flask(__name__, template_folder='D:/Desktop/my_hmm_gmm_speech_recognition/updated_grade_management/app/main/templates')
    app.config.from_object(config_class)

    # Enable CSRF protection
    csrf = CSRFProtect()
    csrf.init_app(app)

    db.init_app(app)

    from .main import bp as main_bp
    app.register_blueprint(main_bp)

    return app

